package com.heima.wemedia.controller.admin;

import com.heima.model.admin.dtos.ChannelDto;
import com.heima.model.admin.dtos.ChannelPageDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.wemedia.service.WmChannelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping
@Slf4j
@Api("admin要用的频道")
@RequiredArgsConstructor
@RestController
public class ChannelController {
    private final WmChannelService wmChannelService;
    @ApiOperation("分页查询频道")
    @PostMapping("/admin/channel/list")
    public ResponseResult queryPageChannel(@RequestBody ChannelPageDto dto){
        log.info("要检查敏感词的分页参数为{}",dto);
        return wmChannelService.queryPageChannel(dto);
    }
    @ApiOperation("新增频道")
    @PostMapping("/admin/channel/add")
    public ResponseResult addChannel(@RequestBody ChannelDto dto){
        log.info("要添加频道的参数为{}",dto);
        return wmChannelService.addChannel(dto);
    }
    @ApiOperation("修改频道")
    @PostMapping("/admin/channel/update")
    public ResponseResult modifyChannel(@RequestBody ChannelDto dto){
        log.info("要修改频道的参数为{}",dto);
        return wmChannelService.modifyChannel(dto);
    }
    @ApiOperation("删除频道")
    @PostMapping("/admin/channel/delete")
    public ResponseResult deleteChannel(@RequestBody String id){
        log.info("要删除频道的id参数为{}",id);
        return wmChannelService. deleteChannel(id);
    }
}
